Package-level declarations

Entrypoint for the Search API: a Kotlin DSL (domain-specific language) for searching local FHIR resources.

Types

Link copied to clipboard
interface BaseSearch

Defines the basic functionality provided by the search including filter, sort and logical operation on filters.

Link copied to clipboard
Link copied to clipboard
data class ConditionParam<T>(val condition: String, val params: List<T>)
Link copied to clipboard

Logical operator between the filter values or the filters themselves.

Link copied to clipboard
enum Order : Enum<Order>
Link copied to clipboard
class Search(val type: ResourceType, var count: Int? = null, var from: Int? = null) : BaseSearch
Link copied to clipboard
data class SearchQuery(val query: String, val args: List<Any>)

Properties

Link copied to clipboard
val LAST_UPDATED_PARAM: DateClientParam

Resource Date Parameter to search using remote last updated date.

Link copied to clipboard
val LOCAL_LAST_UPDATED_PARAM: DateClientParam

Resource Date Parameter to search using local last updated date.

Functions

Link copied to clipboard
inline suspend fun <R : Resource> FhirEngine.count(init: Search.() -> Unit): Long
Link copied to clipboard
fun Search.getQuery(isCount: Boolean = false): SearchQuery
Link copied to clipboard
inline fun <R : Resource> Search.has(referenceParam: ReferenceClientParam, init: BaseSearch.() -> Unit)

Provides limited support for the reverse chaining on https://www.hl7.org/fhir/search.html#has. For example: search all Patient that have Condition - Diabetes. This search uses the subject field in the Condition resource. Code snippet:

fun Search.has(resourceType: ResourceType, referenceParam: ReferenceClientParam, init: BaseSearch.() -> Unit)

Provide limited support for reverse chaining on Search (See this).

Link copied to clipboard
inline fun <R : Resource> Search.include(referenceParam: ReferenceClientParam, init: BaseSearch.() -> Unit = {})

Includes additional resources in the search results that reference that reference the resource on which include is being called. The developers may call include multiple times with different ResourceType to allow search api to return multiple referenced resource types.

fun Search.include(resourceType: ResourceType, referenceParam: ReferenceClientParam, init: BaseSearch.() -> Unit = {})

Includes additional resources in the search results that reference the resource on which include is being called. The developers may call include multiple times with different ResourceType to allow search api to return multiple referenced resource types.

Link copied to clipboard
inline fun <R : Resource> Search.revInclude(referenceParam: ReferenceClientParam, init: BaseSearch.() -> Unit = {})
fun Search.revInclude(resourceType: ResourceType, referenceParam: ReferenceClientParam, init: BaseSearch.() -> Unit = {})

Includes additional resources in the search results that reference the resource on which revInclude is being called. The developers may call revInclude multiple times with different ResourceType to allow search api to return multiple referenced resource types.

Link copied to clipboard
inline suspend fun <R : Resource> FhirEngine.search(init: Search.() -> Unit): List<SearchResult<R>>

Searches the database and returns a list of resources matching the Search specifications.

suspend fun FhirEngine.search(xFhirQuery: String): List<SearchResult<Resource>>
suspend fun FhirEngine.search(resourceType: ResourceType, init: Search.() -> Unit): List<SearchResult<Resource>>